import axios from "axios";
export let setname = (data)=>{ // 如果是同步的话，return一个对象
    return {
        type:"setname",
        payload:data
    }
}
export let getlist = () => { // 如果是异步的话，返回一个函数
    // console.log("render");
    return (dispatch)=>{
        console.log("render");
        axios.get("/api/list").then(res=>{
            console.log("render");
            console.log(res.data);
            dispatch({
                type:"getlist",
                payload:res.data
            })
        })
    }
}
export let searchfn = (payload)=>{
    return {
        type:"searchfn",
        payload
    }
}